
/* 综合信息 */
function getZhxx(url){
		$.dpAjax({
		show:true,
 		url:url,
			data:{busiId:busiId},
			success: function(datas){
			 var data = datas.result;
			 if(data) {
			 /*当前垫提车款*/
			 var cwRemitCar = data.cwRemitCar;
			 if(cwRemitCar) {
				 $('#zhxx_timeRemit').text(formateTime(cwRemitCar.timeRemit));
				 $('#fangk_timeRemit').text(formateTime(cwRemitCar.timeRemit));
				 $('#zhxx_typeBalance').text(cwRemitCar.typeBalanceDisplay);
				 $('#fangk_typeBalance').text(cwRemitCar.typeBalanceDisplay);
				 $('#zhxx_timeArrive').text(formateTime(cwRemitCar.timeArrive));
				 $('#zhxx_financialRecordsNumber').text(cwRemitCar.financialRecordsNumber);
				 $('#fangk_financialRecordsNumber').text(cwRemitCar.financialRecordsNumber);
				 $('#zhxx_remarks').html(cwRemitCar.remarks);
				 $('#fangk_remarks').html(cwRemitCar.remarks);
			 } else {
				 $('#zhxx_timeRemit').text('-');
				 $('#zhxx_typeBalance').text('-');
				 $('#fangk_timeRemit').text('-');
				 $('#fangk_typeBalance').text('-');
				 $('#zhxx_timeArrive').text('-');
				
				 $('#zhxx_financialRecordsNumber').text('-');
				 $('#fangk_financialRecordsNumber').text('-');
				 $('#zhxx_remarks').html('-');
				 $('#fangk_remarks').html('-');
			 }
			 /*银行放款*/
			 var dzLending = data.dzLending;
			 if(dzLending) {
				 $('#ywlcxx_timeArrive').text(formateTime(dzLending.timeLending));
				 $('#fangk_timeLending').text(formateTime(dzLending.timeLending));
				 $('#fangk_amountLending').text(showNumber(dzLending.amountLending));
			 } else {
				 $('#ywlcxx_timeArrive').text('-');
				 $('#fangk_timeLending').text('-');
				 $('#fangk_amountLending').text('-');
			 }
				 
			 /*垫提车款 退提车款*/
			 var cwRemitCars = data.cwRemitCars;
			 if(cwRemitCars && cwRemitCars.length > 0){
				 
				 $('.fangkHtml').remove(); //清空垫款信息
				 var fangkHmtl = '';
				 var length = cwRemitCars.length;
				 for(var i = 0; i < length; i++){
					 var tempCwRemitCar = cwRemitCars[i];
					/* $('#zhxx_time_remit_' + i).val(formateTime(tempCwRemitCar.timeRemit));*/
					 if(i % 2 == 0) {
						 fangkHmtl += '<tr class="fangkHtml">';
					 }
					/* $('#fangk_time_remit_' + i).html(formateTime(tempCwRemitCar.timeRemit));*/
					 fangkHmtl += '<td align="right"><label class="control-label">第'+ (i + 1) + '次垫付时间：</label></td>';
					 fangkHmtl += '<td><div class="control-div np" id="fangk_time_remit_' + (i + 1) + '">' + formateTime(tempCwRemitCar.timeRemit) + '</div></td>';
					 var cwRefundCar = tempCwRemitCar.cwRefundCar
					 if(cwRefundCar && cwRefundCar.timeArrive) {
					 	/*$('#zhxx_time_refund_' + i).val(formateTime(cwRefundCar.timeArrive));*/
					 	/*$('#fangk_time_refund_' + i).html(formateTime(cwRefundCar.timeArrive));*/
					 	 fangkHmtl += '<td align="right"><label class="control-label">第'+ (i + 1) + '次退垫时间：</label></td>';
					 	 fangkHmtl += '<td><div class="control-div np" id="fangk_time_refund_' + (i + 1) + '">' + formateTime(cwRefundCar.timeArrive) + '</div></td>';
					 } else {
						/*$('#zhxx_time_refund_' + i).val('-');*/
						/*$('#fangk_time_refund_' + i).html('-');*/
					 }
					 
					 if((i % 2 == 1) || (i == length - 1)) {
						 fangkHmtl += '</tr>';
					 }
				 }
				 $('#fangk_insertBefore').before(fangkHmtl);
			 } else {
				 $('.fangkHtml').remove();
			 }
			/*结清*/
		 	var dhSettle = data.dhSettle;
			if(dhSettle) {
				$('#zhxx_timeReceive').text(formateTime(dhSettle.timeReceive));
				$('#zhxx_creatorName').text(dhSettle.creatorName);
				$('#zhxx_created').text(formateIntegerTime(dhSettle.created,'yyyy-MM-dd hh:mm:ss'));
				$('#zhxx_timeReceive_1').text(formateTime(dhSettle.timeReceive));
				
				$('#fangk_timeReceive').text(formateTime(dhSettle.timeReceive));
				$('#fangk_timeReceive_1').text(formateTime(dhSettle.timeReceive));
				$('#fangk_creatorName').text(dhSettle.creatorName);
				$('#fangk_created').text(formateIntegerTime(dhSettle.created));
				$('#fangk_jieqing_remarks').html(dhSettle.remarks);
			} else {
				clearSettle();
			}
				/*贷后信息登记*/
			 	var dhLoanAfter = data.dhLoanAfter;
				if(dhLoanAfter){
					$('#zhxx_dateFirstMonth').text(formateDate(dhLoanAfter.dateFirstMonth));
					$('#fangk_dateFirstMonth').text(formateDate(dhLoanAfter.dateFirstMonth));
					$('#zhxx_timeCardSend').text(formateDate(dhLoanAfter.timeCardSend));
					$('#fangk_timeCardSend').text(formateDate(dhLoanAfter.timeCardSend));
					$('#zhxx_timeCardReceive').text(formateDate(dhLoanAfter.timeCardReceive));
					$('#fangk_timeCardReceive').text(formateDate(dhLoanAfter.timeCardReceive));
					$('#zhxx_dateRepayment').text('每月' + dhLoanAfter.dateRepayment + '日');
					$('#fangk_dateRepayment').text(dhLoanAfter.dateRepayment);
					$('#zhxx_addrCardSend').text(dhLoanAfter.addrCardSend);
					$('#fangk_addrCardSend').text(dhLoanAfter.addrCardSend);
					$('#zhxx_remarks_5').html(dhLoanAfter.remarkCardSend);
					$('#fangk_remarks_5').html(dhLoanAfter.remarkCardSend);
				} else {
					clearLoanAfter();
				}
				/* 归档 */
				var dhArchive = data.dhArchive;
				if(dhArchive){
					$('#zhxx_noRecord').text(dhArchive.noRecord);
					$('#fangk_noRecord').text(dhArchive.noRecord);
				} else {
					clearArchive();
				}
				/* 退贷 */
				var dzLoanExit = data.dzLoanExit;
				if(dzLoanExit) {
					$('#zhxx_dateExit').text(formateTime(dzLoanExit.dateExit));
					$('#fangk_dateExit').text(formateTime(dzLoanExit.dateExit));
					$('#ywlcxx_dateExit').text(formateTime(dzLoanExit.dateExit));
				} else {
					clearLoanExit();
				}
				/*贷中信息登记：银行*/
				var dzLoanMiddleBank = data.dzLoanMiddleBank;
				if(dzLoanMiddleBank){
					$('#ywlcxx_txtPledge').text(dzLoanMiddleBank.txtPledge);
					$('#zhxx_contractNo').text(dzLoanMiddleBank.contractNo);
					$('#fangk_contractNo').text(dzLoanMiddleBank.contractNo);
					$('#ywlcxx_contractNo').text(dzLoanMiddleBank.contractNo);
					$('#zhxx_cardnoRefund').text(dzLoanMiddleBank.cardnoRefund);
					$('#fangk_cardnoRefund').text(dzLoanMiddleBank.cardnoRefund);
					$('#ywlcxx_cardnoRefund').text(dzLoanMiddleBank.cardnoRefund);
					var timeReceiveBank2 = dzLoanMiddleBank.timeReceiveBank2;
					var shangwu;
					if(timeReceiveBank2 == 1){
						shangwu = '上午';
					} else if(timeReceiveBank2 == 2){
						shangwu = '下午';
					} else {
						shangwu = '';
					}
					$('#zhxx_timeReceiveBank').text(formateTime(dzLoanMiddleBank.timeReceiveBank) + ' ' + shangwu);
					$('#ywlcxx_timeReceiveBank').text(formateTime(dzLoanMiddleBank.timeReceiveBank) + ' ' + shangwu);
					$('#fangk_timeReceiveBank').text(formateTime(dzLoanMiddleBank.timeReceiveBank) + ' ' + shangwu);
					$('#zhxx_timeSubsequentInform').text(formateTime(dzLoanMiddleBank.timeSubsequentInform));
					$('#fangk_timeSubsequentInform').text(formateTime(dzLoanMiddleBank.timeSubsequentInform));
					$('#ywlcxx_timeSubsequentInform').text(formateTime(dzLoanMiddleBank.timeSubsequentInform));
					$('#zhxx_timeSubsequentReceive').text(formateTime(dzLoanMiddleBank.timeSubsequentReceive));
					$('#fangk_timeSubsequentReceive').text(formateTime(dzLoanMiddleBank.timeSubsequentReceive));
					$('#ywlcxx_timeSubsequentReceive').text(formateTime(dzLoanMiddleBank.timeSubsequentReceive));
					$('#zhxx_remarks_4').html(dzLoanMiddleBank.remarkSubsequent);
					$('#ywlcxx_remarks_4').html(dzLoanMiddleBank.remarkSubsequent);
					$('#fangk_remarks_4').html(dzLoanMiddleBank.remarkSubsequent);
					$('#ywlcxx_bank_creatorName').text(dzLoanMiddleBank.creatorName);
					$('#ywlcxx_bank_created').text(formateIntegerTime(dzLoanMiddleBank.created,'yyyy-MM-dd hh:mm'));
					$('#zhxx_timeReceiveOpencard').text(formateTime(dzLoanMiddleBank.timeReceiveOpencard));
					$('#fangk_timeReceiveOpencard').text(formateTime(dzLoanMiddleBank.timeReceiveOpencard));
					$('#ywlcxx_timeReceiveOpencard').text(formateTime(dzLoanMiddleBank.timeReceiveOpencard));
				} else {
					clearLoanMiddleBank();
				}
				/*贷中信息登记：风控*/
				var dzLoanMiddleAudit = data.dzLoanMiddleAudit;
				if(dzLoanMiddleAudit) {
					$('#zhxx_timeReceiveContract').text(formateTime(dzLoanMiddleAudit.timeReceiveContract));
					$('#fangk_timeReceiveContract').text(formateTime(dzLoanMiddleAudit.timeReceiveContract));
					$('#ywlcxx_timeReceiveContract').text(formateTime(dzLoanMiddleAudit.timeReceiveContract));
					$('#zhxx_remarks_0').html(dzLoanMiddleAudit.remarkReceiveContract);
					$('#ywlcxx_remarks_0').html(dzLoanMiddleAudit.remarkReceiveContract);
					$('#fangk_remarks_0').html(dzLoanMiddleAudit.remarkReceiveContract);
					$('#zhxx_timeApplyOpencard').text(formateTime(dzLoanMiddleAudit.timeApplyOpencard));
					$('#fangk_timeApplyOpencard').text(formateTime(dzLoanMiddleAudit.timeApplyOpencard));
					$('#ywlcxx_timeApplyOpencard').text(formateTime(dzLoanMiddleAudit.timeApplyOpencard));
					$('#zhxx_timeContractFull').text(formateTime(dzLoanMiddleAudit.timeContractFull));
					$('#fangk_timeContractFull').text(formateTime(dzLoanMiddleAudit.timeContractFull));
					$('#ywlcxx_timeContractFull').text(formateTime(dzLoanMiddleAudit.timeContractFull));
					$('#zhxx_timeContractPrint').text(formateTime(dzLoanMiddleAudit.timeContractPrint));
					$('#fangk_timeContractPrint').text(formateTime(dzLoanMiddleAudit.timeContractPrint));
					$('#ywlcxx_timeContractPrint').text(formateTime(dzLoanMiddleAudit.timeContractPrint));
					$('#zhxx_remarks_1').html(dzLoanMiddleAudit.remarkContractFull);
					$('#ywlcxx_remarks_1').html(dzLoanMiddleAudit.remarkContractFull);
					$('#fangk_remarks_1').html(dzLoanMiddleAudit.remarkContractFull);
					$('#zhxx_timeContractHandPrint').text(formateTime(dzLoanMiddleAudit.timeContractHandPrint));
					$('#fangk_timeContractHandPrint').text(formateTime(dzLoanMiddleAudit.timeContractHandPrint));
					$('#ywlcxx_timeContractHandPrint').text(formateTime(dzLoanMiddleAudit.timeContractHandPrint));
					$('#zhxx_operatorContractPrint').text(dzLoanMiddleAudit.operatorContractPrint);
					$('#fangk_operatorContractPrint').text(dzLoanMiddleAudit.operatorContractPrint);
					$('#ywlcxx_operatorContractPrint').text(dzLoanMiddleAudit.operatorContractPrint);
					$('#zhxx_remarks_2').html(dzLoanMiddleAudit.remarkContractHandPrint);
					$('#ywlcxx_remarks_2').html(dzLoanMiddleAudit.remarkContractHandPrint);
					$('#fangk_remarks_2').html(dzLoanMiddleAudit.remarkContractHandPrint);
					var timeSendToBank2 = dzLoanMiddleAudit.timeSendToBank2;
					var shangwu;
					if(timeSendToBank2 == 1){
						shangwu = '上午';
					} else if(timeSendToBank2 == 2){
						shangwu = '下午';
					} else {
						shangwu = '';
					}
					$('#zhxx_timeSendToBank').text(formateTime(dzLoanMiddleAudit.timeSendToBank) + ' ' + shangwu);
					$('#ywlcxx_timeSendToBank').text(formateTime(dzLoanMiddleAudit.timeSendToBank) + ' ' + shangwu);
					$('#fangk_timeSendToBank').text(formateTime(dzLoanMiddleAudit.timeSendToBank) + ' ' + shangwu);
					$('#zhxx_remarks_3').html(dzLoanMiddleAudit.remarkContractPrint);
					$('#ywlcxx_remarks_3').html(dzLoanMiddleAudit.remarkContractPrint);
					$('#fangk_remarks_3').html(dzLoanMiddleAudit.remarkContractPrint);
					$('#ywlcxx_audit_creatorName').text(dzLoanMiddleAudit.creatorName);
					$('#ywlcxx_audit_created').text(formateIntegerTime(dzLoanMiddleAudit.created,'yyyy-MM-dd hh:mm'));
				}  else {
					clearLoanMiddleAudit();
				}
			 }
         }
 	});
}

function clearSettle(){
	$('#zhxx_timeReceive').text('-');
	$('#zhxx_creatorName').text('-');
	$('#zhxx_created').text('-');
	$('#zhxx_timeReceive_1').text('-');
	
	$('#fangk_timeReceive').text('-');
	$('#fangk_timeReceive_1').text('-');
	$('#fangk_jieqing_remarks').html('-');
	$('#fangk_created').text('-');
	$('#fangk_creatorName').text('-');
}

function clearLoanAfter(){
	$('#zhxx_dateFirstMonth').text('-');
	$('#fangk_dateFirstMonth').text('-');
	$('#zhxx_timeCardSend').text('-');
	$('#fangk_timeCardSend').text('-');
	$('#zhxx_timeCardReceive').text('-');
	$('#fangk_timeCardReceive').text('-');
	$('#zhxx_dateRepayment').text('-');
	$('#fangk_dateRepayment').text('-');
	$('#zhxx_addrCardSend').text('-');
	$('#fangk_addrCardSend').text('-');
	$('#zhxx_remarks_5').html('-');
	$('#fangk_remarks_5').html('-');
}

function clearArchive(){
	$('#zhxx_noRecord').text('-');
	$('#fangk_noRecord').text('-');
}

function clearLoanExit(){
	$('#zhxx_dateExit').text('-');
	$('#fangk_dateExit').text('-');
	$('#ywlcxx_dateExit').text('-');
}

function clearLoanMiddleBank(){
	$('#ywlcxx_txtPledge').text('-');
	$('#zhxx_contractNo').text('-');
	$('#fangk_contractNo').text('-');
	$('#ywlcxx_contractNo').text('-');
	$('#zhxx_cardnoRefund').text('-');
	$('#fangk_cardnoRefund').text('-');
	$('#ywlcxx_cardnoRefund').text('-');
	$('#zhxx_timeReceiveBank').text('-');
	$('#ywlcxx_timeReceiveBank').text('-');
	$('#fangk_timeReceiveBank').text('-');
	$('#zhxx_timeSubsequentInform').text('-');
	$('#fangk_timeSubsequentInform').text('-');
	$('#ywlcxx_timeSubsequentInform').text('-');
	$('#zhxx_timeSubsequentReceive').text('-');
	$('#fangk_timeSubsequentReceive').text('-');
	$('#ywlcxx_timeSubsequentReceive').text('-');
	$('#zhxx_remarks_4').html('-');
	$('#ywlcxx_remarks_4').html('-');
	$('#fangk_remarks_4').html('-');
	$('#ywlcxx_bank_creatorName').text('-');
	$('#ywlcxx_bank_created').text('-');
}

function clearLoanMiddleAudit(){
	$('#zhxx_timeReceiveContract').text('-');
	$('#fangk_timeReceiveContract').text('-');
	$('#ywlcxx_timeReceiveContract').text('-');
	$('#zhxx_remarks_0').html('-');
	$('#ywlcxx_remarks_0').html('-');
	$('#fangk_remarks_0').html('-');
	$('#zhxx_timeApplyOpencard').text('-');
	$('#fangk_timeApplyOpencard').text('-');
	$('#ywlcxx_timeApplyOpencard').text('-');
	$('#zhxx_timeReceiveOpencard').text('-');
	$('#fangk_timeReceiveOpencard').text('-');
	$('#ywlcxx_timeReceiveOpencard').text('-');
	$('#zhxx_timeContractFull').text('-');
	$('#fangk_timeContractFull').text('-');
	$('#ywlcxx_timeContractFull').text('-');
	$('#zhxx_timeContractPrint').text('-');
	$('#fangk_timeContractPrint').text('-');
	$('#ywlcxx_timeContractPrint').text('-');
	$('#zhxx_remarks_1').html('-');
	$('#ywlcxx_remarks_1').html('-');
	$('#fangk_remarks_1').html('-');
	$('#zhxx_timeContractHandPrint').text('-');
	$('#fangk_timeContractHandPrint').text('-');
	$('#ywlcxx_timeContractHandPrint').text('-');
	$('#zhxx_operatorContractPrint').text('-');
	$('#fangk_operatorContractPrint').text('-');
	$('#ywlcxx_operatorContractPrint').text('-');
	$('#zhxx_remarks_2').html('-');
	$('#ywlcxx_remarks_2').html('-');
	$('#fangk_remarks_2').html('-');
	$('#zhxx_timeSendToBank').text('-');
	$('#ywlcxx_timeSendToBank').text('-');
	$('#fangk_timeSendToBank').text('-');
	$('#zhxx_remarks_3').html('-');
	$('#ywlcxx_remarks_3').html('-');
	$('#fangk_remarks_3').html('-');
	$('#ywlcxx_audit_creatorName').text('-');
	$('#ywlcxx_audit_created').text('-');
}